//
//  LGOtherZupuViewController.m
//  ligenyun
//
//  Created by Mac on 2018/4/10.
//  Copyright © 2018年 stoneobs@icloud.com. All rights reserved.
//

#import "LGOtherZupuViewController.h"

@interface LGOtherZupuViewController ()
@property(nonatomic, strong) NSArray                     *dataSouce;
@end

@implementation LGOtherZupuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"族谱";
    [self configSubView];
    [self configDataSouce];
    // Do any additional setup after loading the view.
}

#pragma mark --subView
- (void)configSubView{
    UIView * header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 95)];
    header.backgroundColor = [UIColor whiteColor];
    
    UIImageView* bannerImageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 15, 100, 120)];
    bannerImageView.image = [UIImage imageNamed:@"图03"];
    [header addSubview:bannerImageView];
    
    
    
    STLabel * titleLable = [[STLabel alloc] initWithFrame:CGRectMake(bannerImageView.right + 30, bannerImageView.top + 10, 300, 30)
                                                     text:@"赵氏族谱"
                                                textColor:FirstTextColor
                                                     font:14
                                              isSizetoFit:NO
                                            textAlignment:NSTextAlignmentLeft];
    [header addSubview:titleLable];
    
    
    STLabel*shiZuLable = [[STLabel alloc] initWithFrame:CGRectMake(bannerImageView.right + 30, titleLable.bottom, 300, 20)
                                                text:@"始祖:赵朝朝"
                                           textColor:SecendTextColor
                                                font:13
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentLeft];
    
    [header addSubview:shiZuLable];
    
    STLabel*sfangXiLable = [[STLabel alloc] initWithFrame:CGRectMake(bannerImageView.right + 30, shiZuLable.bottom, 300, 20)
                                                 text:@"房系:赵朝"
                                            textColor:SecendTextColor
                                                 font:13
                                          isSizetoFit:NO
                                        textAlignment:NSTextAlignmentLeft];
    
    [header addSubview:sfangXiLable];
    
    STLabel*juanHaoLable = [[STLabel alloc] initWithFrame:CGRectMake(bannerImageView.right + 30, sfangXiLable.bottom, 300, 20)
                                                  text:@"券号:1231231231"
                                             textColor:SecendTextColor
                                                  font:13
                                           isSizetoFit:NO
                                         textAlignment:NSTextAlignmentLeft];
    
    [header addSubview:juanHaoLable];
    
    
    STLabel*updatTimeLable = [[STLabel alloc] initWithFrame:CGRectMake(bannerImageView.right + 30, juanHaoLable.bottom, 300, 20)
                                                    text:@"修谱时间:2018年03月26日13:59:14"
                                               textColor:SecendTextColor
                                                    font:13
                                             isSizetoFit:NO
                                           textAlignment:NSTextAlignmentLeft];
    
    [header addSubview:updatTimeLable];
    
    STLabel*addLable = [[STLabel alloc] initWithFrame:CGRectMake(bannerImageView.right + 30, updatTimeLable.bottom, 300, 20)
                                              text:@"地址:成都市高新区"
                                         textColor:SecendTextColor
                                              font:13
                                       isSizetoFit:NO
                                     textAlignment:NSTextAlignmentLeft];
    
    [header addSubview:addLable];
    
    header.height = addLable.bottom  + 40;
    self.tableView.tableHeaderView = header;
}
- (void)configDataSouce{
    self.dataSouce = @[
                       [[STTableEasyModel alloc] initWithTextString:@"联系人:赵姐" detailString:@""],
                       [[STTableEasyModel alloc] initWithTextString:@"电话：18380461887" detailString:@""],
                       [[STTableEasyModel alloc] initWithTextString:@"地址：车鞥都市打" detailString:@""],
                       [[STTableEasyModel alloc] initWithTextString:@"创建时间：2018-03-26 14:08:28" detailString:@""],
                       [[STTableEasyModel alloc] initWithTextString:@"本谱权限:族谱卡课可见" detailString:@""],
                       [[STTableEasyModel alloc] initWithTextString:@"简介:" detailString:@""]
                       ];
    [self.tableView reloadData];
}
#pragma --mark UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1    ;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return self.dataSouce.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 44;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return 10;
}
- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    return [UIView new];
}
- (UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    return [UIView new];
}
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString * reuseIdentifier =  @"cell";
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
        
    }
    cell.textLabel.textColor = UIColorFromRGBA(0x333333);
    cell.textLabel.font = [UIFont systemFontOfSize:14];
    cell.detailTextLabel.font = [UIFont systemFontOfSize:13];
    cell.detailTextLabel.textColor = UIColorFromRGBA(0x999999);
    STTableEasyModel * model = self.dataSouce[indexPath.row];
    [cell setSt_tableEasyModel:model];
    cell.accessoryType = UITableViewCellAccessoryNone;
    return cell;
}
#pragma --mark UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    [self.tableView deselectRowAtIndexPath:indexPath animated:NO];
}
@end
